package com.zxh.listdemo;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

/**
 * Created by zhangxuehui on 2018/2/27.
 */

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    public static final String SHOW_VIEW_TYPE = "show_view_type";
    private TextView mTvListviewOne;
    private TextView mTvListviewMulti;
    private TextView mTvListviewOneEncap;
    private TextView mTvListviewMultiEncap;
    private TextView mTvRecyclerviewOne;
    private TextView mTvRecyclerviewMulti;
    private TextView mTvRecyclerviewOneEncap;
    private TextView mTvRecyclerviewMultiEncap;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        mTvListviewOne = findViewById(R.id.tv_listview_one);
        mTvListviewMulti = findViewById(R.id.tv_listview_multi);
        mTvListviewOneEncap = findViewById(R.id.tv_listview_one_encap);
        mTvListviewMultiEncap = findViewById(R.id.tv_listview_multi_encap);
        mTvRecyclerviewOne = findViewById(R.id.tv_recyclerview_one);
        mTvRecyclerviewMulti = findViewById(R.id.tv_recyclerview_multi);
        mTvRecyclerviewOneEncap = findViewById(R.id.tv_recyclerview_one_encap);
        mTvRecyclerviewMultiEncap = findViewById(R.id.tv_recyclerview_multi_encap);
        mTvListviewOne.setOnClickListener(this);
        mTvListviewMulti.setOnClickListener(this);
        mTvListviewOneEncap.setOnClickListener(this);
        mTvListviewMultiEncap.setOnClickListener(this);
        mTvRecyclerviewOne.setOnClickListener(this);
        mTvRecyclerviewMulti.setOnClickListener(this);
        mTvRecyclerviewOneEncap.setOnClickListener(this);
        mTvRecyclerviewMultiEncap.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            default:
                break;
            case R.id.tv_listview_one:
                startActivity(new Intent(this, ListActivity.class).putExtra(SHOW_VIEW_TYPE, v.getId()));
                break;
            case R.id.tv_listview_multi:
                startActivity(new Intent(this, ListActivity.class).putExtra(SHOW_VIEW_TYPE, v.getId()));
                break;
            case R.id.tv_listview_one_encap:
                startActivity(new Intent(this, ListActivity.class).putExtra(SHOW_VIEW_TYPE, v.getId()));
                break;
            case R.id.tv_listview_multi_encap:
                startActivity(new Intent(this, ListActivity.class).putExtra(SHOW_VIEW_TYPE, v.getId()));
                break;
            case R.id.tv_recyclerview_one:
                startActivity(new Intent(this, ListActivity.class).putExtra(SHOW_VIEW_TYPE, v.getId()));
                break;
            case R.id.tv_recyclerview_multi:
                startActivity(new Intent(this, ListActivity.class).putExtra(SHOW_VIEW_TYPE, v.getId()));
                break;
            case R.id.tv_recyclerview_one_encap:
                startActivity(new Intent(this, ListActivity.class).putExtra(SHOW_VIEW_TYPE, v.getId()));
                break;
            case R.id.tv_recyclerview_multi_encap:
                startActivity(new Intent(this, ListActivity.class).putExtra(SHOW_VIEW_TYPE, v.getId()));
                break;
        }
    }
}
